Skip to content

Add ft support#257

Open
fedemengo wants to merge 1 commit into
gvalkov:mainfrom
fedemengo:feat/ft-support
Open

Add ft support#257
fedemengo wants to merge 1 commit into
gvalkov:mainfrom
fedemengo:feat/ft-support

Conversation

@fedemengo

Copy link
Copy Markdown

Closes #256

before

> uv venv /tmp/test-main-ft --python 3.13t
Using CPython 3.13.12+freethreaded interpreter at: .local/bin/python3.13t
Creating virtual environment at: /tmp/test-main-ft
Activate with: source /tmp/test-main-ft/bin/activate
~                                                                      py test-git-ft fedemengo@fedora 14:43:30
> source /tmp/test-git-ft/bin/activate
~                                                                      py test-git-ft fedemengo@fedora 13:28:54
> uv pip install evdev
Using Python 3.13.12 environment at: /tmp/test-main-ft
Resolved 1 package in 175ms
      Built evdev==1.9.3
Prepared 1 package in 985ms
░░░░░░░░░░░░░░░░░░░░ [0/1] Installing wheels...                                                                 warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 1 package in 0.80ms
 + evdev==1.9.3
~                                                                     py test-main-ft fedemengo@fedora 14:44:46
> python -c "import sys
print('free-threaded build:', not sys._is_gil_enabled())  # starts False in ft build
import evdev
print('GIL after import:', sys._is_gil_enabled())  # should still be False with fix"
free-threaded build: True
<frozen importlib._bootstrap>:488: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module 'evdev._input', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.
GIL after import: True

after

> uv venv /tmp/test-ft --python 3.13t
Using CPython 3.13.12+freethreaded interpreter at: .local/bin/python3.13t
Creating virtual environment at: /tmp/test-ft
Activate with: source /tmp/test-ft/bin/activate
~                                                                                     fedemengo@fedora 13:25:17
> source /tmp/test-ft/bin/activate
~                                                                          py test-ft fedemengo@fedora 13:25:21
> uv pip install /tmp/python-evdev
Using Python 3.13.12 environment at: /tmp/test-ft
Resolved 1 package in 10ms
      Built evdev @ file:///tmp/python-evdev
Prepared 1 package in 1.44s
░░░░░░░░░░░░░░░░░░░░ [0/1] Installing wheels...                                                                 warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 1 package in 0.84ms
 + evdev==1.9.3 (from file:///tmp/python-evdev)

> python -c "import sys
print('free-threaded build:', not sys._is_gil_enabled())  # starts False in ft build
import evdev
print('GIL after import:', sys._is_gil_enabled())  # should still be False with fix"
free-threaded build: True
GIL after import: False

@fedemengo

Copy link
Copy Markdown
Author

@gvalkov lmk if this works for you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add free-threaded Python (PEP 703) support

1 participant